
<template>
  <div class="category">
    <header-panda firstPath="/" firstTitle="返回">
      <router-link slot="todayPath" to='/' tag="div" key="1" class="home-nav-item swiper-slide" style="color: #877a73;">
        今日推荐
      </router-link>
    </header-panda>
    <div class="cart-content setPadTop" >
      <ul class="cart-list">
        <!-- :to='{path:"/tab/"+data.id}'  -->
        <cart-item v-for="(item,index) in categoryList" :key="item.commodityId + '-' + index"
        :img="item.image"
        :title="item.title"
        :price="item.price"
        :num="item.saleNum"
        :id="item.id"
        :weight="item.couponValue"
        :free-postage="item.isFreePostage"
        :platform="item.platform"
        ></cart-item>
      </ul>
    </div>
  </div>
</template>
<script>
import headerPanda from '@/components/Header'
import { mapState, mapActions } from 'vuex' // mapState 是vuex提供的切割函数，
import cartItem from '@/components/CartItem'
export default {
  created () {
    this.getCategoryList({ start: 0, path: this.$route.fullPath })
  },
  methods: {
    ...mapActions('categorydata', ['getCategoryList'])
  },
  computed: {
    ...mapState('categorydata', ['categoryList'])
  },
  components: {
    headerPanda,
    cartItem
  }
}
</script>

<style lang="scss" scoped>
</style>
